const path = require("path");
const webpack = require("webpack");
const CopyRightWebpackPlugin = require("./plugins/copyright-webpack-plugin");
const HtmlWebpackPlugin = require("html-webpack-plugin");
module.exports = {
    mode: "development",
    // 监听
    watch: true,
    watchOptions: {
        poll: 1000, // 每秒询问多少次
        aggregateTimeout: 500, //防抖 多少毫秒后再次触发
        ignored: /node_modules/, //忽略时时监听
    },
    entry: "./src/index.js",
    devtool: "source-map",
    output: {
        path: path.resolve(__dirname, "dist"),
        filename: "[name].js",
    },
    plugins: [
        new HtmlWebpackPlugin({
            template: "./index.html",
        }),
        new webpack.HotModuleReplacementPlugin(),
        // new CopyRightWebpackPlugin({
        //     name: 'sr'
        // })
    ],
    devServer: {
        contentBase: "./dist",
        host: "localhost",
        port: 8080,
        inline: true,
        hot: true,
    },
};
